#define AMI_COMBINE(a, b)	MYGUI_COMBINE1(a, b)
#define MYGUI_COMBINE1(a, b)	a##b

#define AMI_DELEGATE AMI_COMBINE(AMI_Delegate, AMI_SUFFIX)

AMI_TEMPLATE AMI_TEMPLATE_PARAMS
class AMI_DELEGATE :
	public IceUtil::Shared,
	public LuaHandler
{
public:
	AMI_DELEGATE(int luaFunc)
		:LuaHandler(luaFunc)
	{
	}
    
    ~AMI_DELEGATE()
    {
    }

	void ice_response(AMI_PARAMS)
	{
#if AMI_SUFFIX
		invoke<const std::string&, AMI_TEMPLATE_TYPES>("response", AMI_ARGS);
#else
		invoke<const std::string&>("response");
#endif
	}

	void ice_exception(const Ice::Exception& ex)
	{
		invoke<const std::string&, const Ice::Exception&>("exception", ex);
	}
};

#undef AMI_COMBINE
#undef AMI_DELEGATE

#undef AMI_SUFFIX
#undef AMI_TEMPLATE
#undef AMI_TEMPLATE_TYPES
#undef AMI_TEMPLATE_PARAMS
#undef AMI_TEMPLATE_ARGS
#undef AMI_PARAMS
#undef AMI_ARGS
#undef AMI_TEMPLATE